home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre3.z / postgre3 / src / lib / H / access / skey.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.7 KB  |  125 lines

  1. /*
  2.  * skey.h --
  3.  *    POSTGRES scan key definitions.
  4.  *
  5.  * Note:
  6.  *    Needs more accessor/assignment routines.
  7.  */
  8.  
  9. #ifndef    SKeyIncluded        /* Include this file only once */
  10. #define SKeyIncluded    1
  11.  
  12. /*
  13.  * Identification:
  14.  */
  15. #define SKEY_H    "$Header: /private/postgres/src/lib/H/access/RCS/skey.h,v 1.13 1991/04/28 09:15:59 cimarron Exp $"
  16.  
  17. #include "tmp/postgres.h"
  18. #include "access/attnum.h"
  19.  
  20. typedef uint16    ScanKeySize;
  21.  
  22. typedef struct ScanKeyEntryData {
  23.     bits16        flags;
  24.     AttributeNumber    attributeNumber;
  25.     RegProcedure    procedure;
  26.     int (*func) ();
  27.     int32 nargs;
  28.     Datum        argument;
  29. } ScanKeyEntryData;
  30.  
  31. #define CheckIfNull        0x1
  32. #define UnaryProcedure        0x2
  33. #define NegateResult        0x4
  34. #define CommuteArguments    0x8
  35.  
  36. #define ScanUnmarked        0x01
  37. #define ScanUncheckedPrevious    0x02
  38. #define ScanUncheckedNext    0x04
  39.  
  40. typedef ScanKeyEntryData    *ScanKeyEntry;
  41.  
  42. typedef struct ScanKeyData {
  43.     ScanKeyEntryData    data[1];    /* VARIABLE LENGTH ARRAY */
  44. } ScanKeyData;
  45.  
  46. typedef ScanKeyData    *ScanKey;
  47.  
  48. /* ----------------
  49.  *    ScanKeyPtr is used in the executor to keep track of
  50.  *    an array of ScanKey's.  This is needed because a single
  51.  *    scan may use several indices and each index has its own
  52.  *    ScanKey. -cim 9/11/89
  53.  * ----------------
  54.  */
  55. typedef ScanKey        *ScanKeyPtr;
  56.  
  57. /*
  58.  * ScanKeyIsValid --
  59.  *    True iff the scan key is valid.
  60.  */
  61. #define ScanKeyIsValid(scanKeySize, key) \
  62.     ((bool) ((scanKeySize) == 0 || PointerIsValid(key)))
  63.          
  64. /*
  65.  * ScanKeyEntryIsValid --
  66.  *    True iff the scan key entry is valid.
  67.  */
  68. #define    ScanKeyEntryIsValid(entry) PointerIsValid(entry)
  69.  
  70. /*
  71.  * ScanKeyEntryIsLegal --
  72.  *    True iff the scan key entry is legal.
  73.  */
  74. #define ScanKeyEntryIsLegal(entry) \
  75.     ((bool) (AssertMacro(ScanKeyEntryIsValid(entry)) && \
  76.          AttributeNumberIsValid(entry->attributeNumber)))
  77.  
  78. /*
  79.  * ScanKeyEntrySetIllegal --
  80.  *    Marks a scan key entry as illegal.
  81.  */
  82. extern
  83. void
  84. ScanKeyEntrySetIllegal ARGS((
  85.     ScanKeyEntry    entry
  86. ));
  87.  
  88. /*
  89.  * ScanKeyEntryInitialize --
  90.  *    Initializes an scan key entry.
  91.  *
  92.  * Note:
  93.  *    Assumes the scan key entry is valid.
  94.  *    Assumes the intialized scan key entry will be legal.
  95.  */
  96. extern
  97. void
  98. ScanKeyEntryInitialize ARGS((
  99.     ScanKeyEntry    entry,
  100.     bits16        flags,
  101.     AttributeNumber    attributeNumber,
  102.     RegProcedure    procedure,
  103.     Datum        argument
  104. ));
  105.  
  106. /* ----------------------------------------------------------------
  107.  *            old access.h definitions
  108.  * ----------------------------------------------------------------
  109.  */
  110. struct    skey {
  111.     int16    sk_flags;    /* flags */
  112.     int16    sk_attnum;    /* domain number */
  113.     OID    sk_opr;        /* procedure OID */
  114.     int     (*func) ();
  115.     int32     nargs;
  116.     DATUM    sk_data;    /* data to compare */
  117. };
  118.  
  119. #define    SK_ISNULL    01
  120. #define    SK_UNARY    02
  121. #define    SK_NEGATE    04
  122. #define    SK_COMMUTE    010
  123.  
  124. #endif    /* !defined(SKeyIncluded) */
  125.